package com.uni.exp5.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * Author:      Unirithe/Mr.Chao
 * CSDN:        https://blog.csdn.net/Unirithe
 * CreatedTime:  2022/1/20 13:26
 **/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Component("player")
public class Player {
    private Equip armet;    // 头盔
    private Equip loricae;  // 铠甲
    private Equip boot;     // 靴子
    @Resource(name = "ring")
    private Equip ring;     // 指环
    public void updateEquip(Equip equip){
        switch (equip.getType()) {
            case "头盔":
                System.out.println(armet.getName() + " 升级为: " + equip.getName());
                this.armet = equip;
                break;
            case "铠甲":
                System.out.println(loricae.getName() + " 升级为: " + equip.getName());
                this.loricae = equip;
                break;
            case "靴子":
                System.out.println(boot.getName() + " 升级为: " + equip.getName());
                this.boot = equip;
                break;
            case "指环":
                System.out.println(ring.getName() + " 升级为: " + equip.getName());
                this.ring = equip;
                break;
            default: break;
        }
    }

}
